<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>基础：5、Class与Style绑定 用在组件上</title>
	<script type="text/javascript" src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
	<div id="app">
		<!-- 在子组件标签上声明的class会绑定到组件模板的根元素上去，对象和数组使用语法同前面的demo -->
		<my-component class="foo bar"></my-component>
	</div>

	<script type="text/javascript">
		Vue.component('my-component',{
			template: '<div class="block"><span class="st">test</span></div>'
		})
		new Vue({
			el: '#app'
		})
	</script>
</body>
</html>
<!-- 代码均通过测试，有什么纰漏欢迎联系 QQ:1123176978  Wechat:hyhlovehuanong -->